using System;
using System.Collections.Generic;
using System.Text;

using KmlUtils;

namespace StormModelToKMLDB
{
    public class Observation
    {
        #region Private Members
        Point _loc;
        int ship;
        int dshp;
        int _hr;
        Category _cat;
        DateTime _dateTime;
        #endregion

        #region Constructors
        public Observation(string lat, string lon)
        {
            string h1 = lat.Substring(lat.Length - 1);
            string h2 = lon.Substring(lon.Length - 1);
            string la = lat.Substring(0,lat.Length - 1);
            string lo = lon.Substring(0,lon.Length - 1);
            double dlat = double.Parse(la);
            double dlon = double.Parse(lo);
            if (h1.Contains("S"))
                dlat = -dlat;
            if (h2.Contains("W"))
                dlon = -dlon;

            this._loc = new Point(AltitudeMode.clampToGround, dlat, dlon, 0.0);
        }

        public Observation(string lat, string lon, int hr) 
            : this(lat, lon)
        {
            this._hr = hr;
        }

        public Observation(Observation from)
        {
            this._loc = from.Location;
            this.ship = from.SHIP;
            this.dshp = from.DSHP;
            this._hr = from.Hour;
            this._cat = from.Cat;
            this._dateTime = from.DateTime;
        }
        #endregion

        #region Public Methods / Properties
        public DateTime DateTime
        {
            get { return this._dateTime; }
            set { this._dateTime = value; }
        }

        public Category Cat
        {
            get { return _cat; }
            set { _cat = value; }
        }

        public double Lat
        {
            get { return this._loc.Lat; }
        }

        public double Lon
        {
            get { return this._loc.Lon; }
        }

        public Point Location
        {
            get { return this._loc; }
        }

        public int SHIP
        {
            get { return this.ship; }
            set { this.ship = value; }
        }

        public int DSHP
        {
            get { return this.dshp; }
            set { this.dshp = value; }
        }

        public int Hour
        {
            get { return this._hr; }
            set { this._hr = value; }
        }
        #endregion
    }
}
